// let p1={name:'国强',age:18,sex:'boy'}
// let p2={name:'加起',age:18,sex:'boy'}


function User(name,age,sex,career){
    this.name=name
    this.age=age
    this.sex=sex
    this.career=career
}

let p=new Person('国强',18,'boy','前端程序员')

//构造器就是将 name,age,sex,career 赋值给对象的过程封装
//确保每个对象都具备这些属性,确保了 共性 不变,个性灵活

function Coder(name,age){
    this.name=name
    this.age=age
    this.career='coder'
    this.work=['写代码','喝茶','摸鱼']
}

function ProductManager(){
    this.name=name
    this.age=age
    this.career='product manager'
    this.work=['订会议室','写PRD','催更']
}

function Factory(name,age,career){
    switch(career){
        case'coder':
        return new Coder(name,age)
        break;
        case'product manager':
        return new ProductManager(name,age)
        break;
        //...
    }
}

function User(name,age,career,work){
    this.name=name
    this.age=age
    this.career=career
    this.work=work
}
function Factory(name,age,career){
    let work;
    switch(career){
        case'coder':
        work=['写代码','喝茶','摸鱼']
        break;
        case'product manager':
        work=['订会议室','写PRD','催更']
        break;
        case'boss':
        work=['接电话','打电话','见客户']
        break;
        //...
    }
    return new User(name,age,career,work)
}
